package com.tourism.home.controller.user;

import com.tourism.home.entity.Result;
import com.tourism.home.service.LikesService;
import com.tourism.home.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class LikesController {

    @Autowired
    LikesService likesService;


    //ok
    @GetMapping("/post/likes/uids/{pid}")
    Result getLikesPostUids(@PathVariable("pid") Integer pid){
        return ResultUtil.success(likesService.getLikesPostUids(pid));
    }
    //ok
    @PutMapping("/likes/add")
    Result addLikes(@RequestParam("pid") Integer pid, @RequestParam("uid") Integer uid){
        return ResultUtil.success(likesService.addLikes(pid,uid));
    }

    //ok
    @DeleteMapping("/likes/del")
    Result deleteLikes(@RequestParam("pid") Integer pid, @RequestParam("uid") Integer uid){
        return ResultUtil.success(likesService.deleteLikes(pid,uid));
    }

}
